<?
$title = "Sales Of Evidence Group View";
$mid = 1;
require("required/dbconnect.php");
require_once("required/function.php");
require("required/header.php");
?>
<script src="required/js/jquery-1.4.2.js"></script>
<script src="required/js/common_javascript.js"></script>
<?
if (!empty($_GET['action'])) {

    switch ($_GET['action']) {
        case 1:
            $msg = "<div class='dw_success'>Data inserted</div>";
            break;
        case 2:
            $msg = "<div class='dw_success'>Data Deleted</div>";
            break;
        case 3:
            $msg = "<div class='dw_success'>Data Updated</div>";
            break;
        case 4:
            $msg = "<div class='dw_failed'>User already exist, insert failed!</div>";
            break;
        default:
            $msg = "";
            break;
    }
    echo "<script>displayMsg('divMsg')</script>";
} else {
    $msg = "";
}

if (empty($_GET['page'])) {
    $page = "1";
} else {
    $page = $_GET['page'];
}

$totalperpage = 30;

$from = ($page - 1) * $totalperpage;

$get_data = mysql_query("select * from os_shipping_upload_group order by group_name") or die(mysql_error());
?>

<table width="100%" cellpadding="0" cellspacing="0" height="100%">

    <td valign="top" align="left">
        <table width="95%" align="center">
            <tr>
                <td class="title">Uploaded Group</td>
            </tr>
            <tr>
                <td><div id="divMsg"><?= $msg ?></div></td>
            </tr>

            <tr>
                <td>
                    <table width="100%" class="solidborder" >
                        <Tr class="table_header">
                            <td width="30">No.</td>
                            <td width="392">Group Name</td>
                            <td width="100">Total Records</td>
                            <Td width="200">Created Date</td>
                            <Td width="255">Action</Td>
                        </Tr>
                        <?
                        if (mysql_num_rows($get_data) == 0) {
                            ?>
                            <tr>
                                <Td colspan="8" align="center"> No record found</Td>
                            </tr>
                            <?
                        } else {
                            $no = $from + 1;



                            while ($a = mysql_fetch_array($get_data, MYSQL_ASSOC)) {
                                if ($no % 2 == 0) {
                                    $class1 = "table_item_even";
                                    $class2 = "table_item_odd";
                                } else {
                                    $class1 = "table_item_odd";
                                    $class2 = "table_item_even";
                                }

                                $get_total = mysql_query("select count(*) as result from os_shipping_zone_rate where group_id='" . $a['id']."'");
                                ?>
                                <tr height="20" valign="top" class="<?= $class1 ?>" align="center" onmouseover="this.className='table_item_mouseover'" 
                                    onmouseout="this.className='<?= $class1 ?>'">
                                    <td><?= $no ?></td>                               	
                                    <td align="left"><?= $a['group_name'] ?></td>
                                    <td align="center"><?= mysql_result($get_total, 0, "result") ?></td>
                                    <td align="center"><?= $a['created_datetime'] ?></td>
                                    <td align="center">
                                        <a href="shipping_group_delete.php?id=<?= $a['id'] ?>"><img src="images/icons/delete.gif" border="0"></a>
                                    </td>   
                                </tr>
                                <?
                                $no++;
                            }
                        }
                        ?>


                    </table>

                </td>
            </tr>
        </table>

    </td>
</table>					
<?
require("required/footer.php");
?>               
